package com.yunti.springboot.commonenum;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author yangtt
 * @date 2023/11/19
 */
@AllArgsConstructor
@Getter

//必考 1
//6选2 2
//8选2 3
//体质健康对应 4
public enum ElectiveEnum {
    必考(1, "必考"),
    六选二(2, "6选2"),
    八选二(3, "8选2"),
    体质健康对应(4, "体质健康对应");
    /**
     * 编码
     */
    private Integer code;

    /**
     * 描述
     */
    private String value;

    public static Integer getCode(String sex) {
        ElectiveEnum[] sexEnums = ElectiveEnum.values();
        for (ElectiveEnum sexEnum : sexEnums) {
            if(sexEnum.getValue().equals(sex)){
                return sexEnum.getCode();
            }
        }
        return 0;
    }
    public static String getValue(Integer code) {
        ElectiveEnum[] sexEnums = ElectiveEnum.values();
        for (ElectiveEnum sexEnum : sexEnums) {
            if(sexEnum.getCode().equals(code)){
                return sexEnum.getValue();
            }
        }
        return "";
    }
}
